//
//  GoodListCollectionViewCell.m
//  Menu
//
//  Created by Lynn-Shin on 15/7/3.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "GoodListCollectionViewCell.h"

@implementation GoodListCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    
    self.itemImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x + 5*WIDTH, self.contentView.frame.origin.x +5*HEIGHT, 160*WIDTH, 85*HEIGHT)];
//    self.itemImage.backgroundColor = [UIColor redColor];
    [self addSubview:self.itemImage];
    [self.itemImage release];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 90*HEIGHT, 170*WIDTH, 30*HEIGHT)];
//    self.titleLabel.backgroundColor = [UIColor lightGrayColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLabel];
    [self.titleLabel release];
    
}

-(void)setGoodList:(GoodListModel *)goodList{
    
    if (_goodList != goodList) {
        
        [_goodList release];
        _goodList = [goodList retain];
    }
    
    [self.itemImage sd_setImageWithURL:[NSURL URLWithString:goodList.imagePathThumbnails] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.titleLabel.text = goodList.name;
}

@end
